package tree;

import javax.swing.*;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Zerktree implements ActionListener {
	
	static int zerktreepoints = 0;
	int totalpoints = 40;
	boolean recentreset = false;
	
	public static int getzerkpoints() {
		return zerktreepoints;
	}
	
	Skill twohmastery = Zerkskills.twohmastery();
	Skill armageddon = Zerkskills.armageddon();
	Skill bash = Zerkskills.bash();
	Skill berserk = Zerkskills.berserk();
	Skill buffalo = Zerkskills.buffalo();
	Skill cruelty = Zerkskills.cruelty();
	Skill crush = Zerkskills.crush();
	Skill dodge = Zerkskills.dodge();
	Skill escape = Zerkskills.escape();
	Skill feast = Zerkskills.feast();
	Skill furious = Zerkskills.furious();
	Skill inertia = Zerkskills.inertia();
	Skill madness = Zerkskills.madness();
	Skill neutralize = Zerkskills.neutralize();
	Skill nocturne = Zerkskills.nocturne();
	Skill nomercy = Zerkskills.nomercy();
	Skill scamper = Zerkskills.scamper();
	Skill tornado = Zerkskills.tornado();
	Skill tranquility = Zerkskills.tranquility();
	Skill upward = Zerkskills.upward();
	Skill vanquish = Zerkskills.vanquish();
	Skill wounds = Zerkskills.wounds();
	Skill zerkblood = Zerkskills.zerkblood();
	
	
	
	static JFrame frame;
	JPanel masterypanel, skills, row1,row2,row3,row4,row5,row6,row7, masrow1,masrow2,masrow3,
	masrow4,masrow5,masrow6,masrow7;
	
	JButton resetall, reset, def, zerk, cleric, sorc, sin, crus, neutraliz, dodg, nomerc, twohmaster, nocturn, berser, buffal, furiou, feas,
			vanquis, armageddo, inerti, tranquilit, cruelt, bas, scampe, wound, upwar, escap, tornad, madnes, zerkbloo;
	
	JLabel title1, title2, info, cru, row1arr, neutrali, dod, nomer, twohmaste, noctur, berse, buffa, furio, fea, row3arr, line1, arr1, arr2, 
			arr3, arr4, vanqui, armagedd, inert, tranquili, cruel, arr5, arr6, arr7, ba, scamp, woun, upwa, esca, torna, madne, zerkblo,
			chain, chai, outrage, outrag, cross, cros, plate, plat, thir1, thir11, thir2, thir22, thir3, thir33, rage1, rage11, rage2, rage22;
	
	static JPanel allpanels;
	
	
public JPanel createContentPane (){
		
		totalpoints = 40;
		zerktreepoints = 0;
		ImageIcon img;
		Image test;
		Image newimg;
		
		ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);

        allpanels = new JPanel();
        allpanels.setLayout(null);
		
        title1 = new JLabel("Actives/Passives");
        title1.setLocation(5, 0);
        title1.setSize(430,20);
        title1.setHorizontalAlignment(0);
        title1.setOpaque(true);
        title1.setBackground(Color.gray);
        allpanels.add(title1);
        
        title2 = new JLabel("Masteries");
        title2.setLocation(435, 0);
        title2.setSize(110,20);
        title2.setHorizontalAlignment(0);
        title2.setOpaque(true);
        title2.setBackground(Color.gray);
        allpanels.add(title2);
        
        skills = new JPanel();
        skills.setLayout(null);
        skills.setSize(430, 430);
        skills.setLocation(5,20);
        allpanels.add(skills);
        
        //masteries
        masterypanel = new JPanel();
        masterypanel.setLayout(null);
        masterypanel.setSize(110, 430);
        masterypanel.setLocation(435,20);
        allpanels.add(masterypanel);
        
      //masteries
        masrow1 = new JPanel();
        masrow1.setLayout(null);
        masrow1.setLocation(0, 0);
        masrow1.setSize(110, 60);
        masrow1.setBackground(Color.lightGray);
        masrow1.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow1);
        
      //Outrage
        img = new ImageIcon(getClass().getResource("/zerk/outrage.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        outrage = new JLabel();
        outrage.setSize(40,40);
        outrage.setToolTipText("<html>Outrage<br>Increases Physical and Magic Attack and Critical chance by 10% for 15 seconds. This<br>" +
        						"effect is triggered by chaining 8 consecutive attacks in a certain period of time or by<br>" +
        						"using the Berserk skill.<br>" +
        						"Requires 5+ points in berserker</html>");
        outrage.setLocation(10, 10);
        outrage.setOpaque(true);
        outrage.setBackground(new Color(128,128,128,175));
        masrow1.add(outrage);
        
        outrag = new JLabel((Icon) img);
        outrag.setSize(40,40);
        outrag.setLocation(10, 10);
        masrow1.add(outrag);
        
      //Chain mastery
        img = new ImageIcon(getClass().getResource("/zerk/chainmastery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        chain = new JLabel();
        chain.setSize(40,40);
        chain.setToolTipText("<html>Chain Armor Mastery<br>Allows you to equip chain armor.<br>" +
        						"Requires 5+ points in berserker</html>");
        chain.setLocation(60, 10);
        chain.setOpaque(true);
        chain.setBackground(new Color(128,128,128,175));
        masrow1.add(chain);
        
        chai = new JLabel((Icon) img);
        chai.setSize(40,40);
        chai.setLocation(60, 10);
        masrow1.add(chai);
        
      //mastrow2
        masrow2 = new JPanel();
        masrow2.setLayout(null);
        masrow2.setLocation(0, 60);
        masrow2.setSize(110, 60);
        masrow2.setBackground(Color.lightGray);
        masrow2.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow2);
        
      //Style mastery
        img = new ImageIcon(getClass().getResource("/zerk/stylemastery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        cross = new JLabel();
        cross.setSize(40,40);
        cross.setToolTipText("<html>Style Mastery: Berserker<br>Allows you learn skills of other styles.<br>" +
        						"Requires 10+ points in berserker</html>");
        cross.setLocation(35, 10);
        cross.setOpaque(true);
        cross.setBackground(new Color(128,128,128,175));
        masrow2.add(cross);
        
        cros = new JLabel((Icon) img);
        cros.setSize(40,40);
        cros.setLocation(35, 10);
        masrow2.add(cros);
        
      //mastrow3
        masrow3 = new JPanel();
        masrow3.setLayout(null);
        masrow3.setLocation(0, 120);
        masrow3.setSize(110, 60);
        masrow3.setBackground(Color.lightGray);
        masrow3.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow3);
        
      //Plate mastery
        img = new ImageIcon(getClass().getResource("/zerk/platemastery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        plate = new JLabel();
        plate.setSize(40,40);
        plate.setToolTipText("<html>Plate Armor Mastery<br>Allows you to equip plate armor.<br>" +
        						"Requires 15+ points in defender</html>");
        plate.setLocation(10, 10);
        plate.setOpaque(true);
        plate.setBackground(new Color(128,128,128,175));
        masrow3.add(plate);
        
        plat = new JLabel((Icon) img);
        plat.setSize(40,40);
        plat.setLocation(10, 10);
        masrow3.add(plat);
        
      //Blood thirst
        img = new ImageIcon(getClass().getResource("/zerk/thirst.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        thir1 = new JLabel();
        thir1.setSize(40,40);
        thir1.setToolTipText("<html>Blood Thirst<br>Reduces the number of hits needed to trigger Outrage by 1.<br>" +
        						"Requires 15+ points in berserker</html>");
        thir1.setLocation(60, 10);
        thir1.setOpaque(true);
        thir1.setBackground(new Color(128,128,128,175));
        masrow3.add(thir1);
        
        thir11 = new JLabel((Icon) img);
        thir11.setSize(40,40);
        thir11.setLocation(60, 10);
        masrow3.add(thir11);
        
      //mastrow4
        masrow4 = new JPanel();
        masrow4.setLayout(null);
        masrow4.setLocation(0, 180);
        masrow4.setSize(110, 60);
        masrow4.setBackground(Color.lightGray);
        masrow4.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow4);
        
      //Sustained Rage 
        img = new ImageIcon(getClass().getResource("/zerk/sustained.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        rage1 = new JLabel();
        rage1.setSize(40,40);
        rage1.setToolTipText("<html>Sustained Rage<br>Increases the duration of Outrage by 5 seconds.<br>" +
        						"Requires 20+ points in berserker</html>");
        rage1.setLocation(35, 10);
        rage1.setOpaque(true);
        rage1.setBackground(new Color(128,128,128,175));
        masrow4.add(rage1);
        
        rage11 = new JLabel((Icon) img);
        rage11.setSize(40,40);
        rage11.setLocation(35, 10);
        masrow4.add(rage11);
        
        
        
        //mastrow5
        masrow5 = new JPanel();
        masrow5.setLayout(null);
        masrow5.setLocation(0, 240);
        masrow5.setSize(110, 60);
        masrow5.setBackground(Color.lightGray);
        masrow5.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow5);
        
      //Blood thirst 2
        img = new ImageIcon(getClass().getResource("/zerk/thirst.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        thir2 = new JLabel();
        thir2.setSize(40,40);
        thir2.setToolTipText("<html>Blood Thirst 2<br>Reduces the number of hits needed to trigger Outrage by 2.<br>" +
        						"Requires 25+ points in berserker</html>");
        thir2.setLocation(35, 10);
        thir2.setOpaque(true);
        thir2.setBackground(new Color(128,128,128,175));
        masrow5.add(thir2);
        
        thir22 = new JLabel((Icon) img);
        thir22.setSize(40,40);
        thir22.setLocation(35, 10);
        masrow5.add(thir22);
        
      //mastrow6
        masrow6 = new JPanel();
        masrow6.setLayout(null);
        masrow6.setLocation(0, 300);
        masrow6.setSize(110, 60);
        masrow6.setBackground(Color.lightGray);
        masrow6.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow6);
        
      //Sustained Rage 
        img = new ImageIcon(getClass().getResource("/zerk/sustained.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        rage2 = new JLabel();
        rage2.setSize(40,40);
        rage2.setToolTipText("<html>Sustained Rage 2<br>Increases the duration of Outrage by 10 seconds.<br>" +
        						"Requires 30+ points in berserker</html>");
        rage2.setLocation(35, 10);
        rage2.setOpaque(true);
        rage2.setBackground(new Color(128,128,128,175));
        masrow6.add(rage2);
        
        rage22 = new JLabel((Icon) img);
        rage22.setSize(40,40);
        rage22.setLocation(35, 10);
        masrow6.add(rage22);
        
        
        //mastrow7
        masrow7 = new JPanel();
        masrow7.setLayout(null);
        masrow7.setLocation(0, 360);
        masrow7.setSize(110, 60);
        masrow7.setBackground(Color.lightGray);
        masrow7.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow7);
        
      //Blood thirst 3
        img = new ImageIcon(getClass().getResource("/zerk/thirst.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        thir3 = new JLabel();
        thir3.setSize(40,40);
        thir3.setToolTipText("<html>Blood Thirst 3<br>Reduces the number of hits needed to trigger Outrage by 3.<br>" +
        						"Requires 35+ points in berserker</html>");
        thir3.setLocation(35, 10);
        thir3.setOpaque(true);
        thir3.setBackground(new Color(128,128,128,175));
        masrow7.add(thir3);
        
        thir33 = new JLabel((Icon) img);
        thir33.setSize(40,40);
        thir33.setLocation(35, 10);
        masrow7.add(thir33);
        
        
        
        def = new JButton();
        def.setText("Defender(0)");
        def.setSize(110,20);
        def.setLocation(5, 450);
        def.setHorizontalAlignment( SwingConstants.LEFT );
        def.addActionListener(this);
        allpanels.add(def);
        
        zerk = new JButton();
        zerk.setText("Berserker(0)");
        zerk.setSize(120,20);
        zerk.setLocation(115, 450);
        zerk.setHorizontalAlignment( SwingConstants.LEFT );
        zerk.addActionListener(this);
        allpanels.add(zerk);
        
        cleric = new JButton();
        cleric.setText("Cleric(0)");
        cleric.setSize(90,20);
        cleric.setLocation(235, 450);
        cleric.setHorizontalAlignment( SwingConstants.CENTER );
        cleric.addActionListener(this);
        allpanels.add(cleric);
        
        sorc = new JButton();
        sorc.setText("Sorcerer(0)");
        sorc.setSize(110,20);
        sorc.setLocation(325, 450);
        sorc.setHorizontalAlignment( SwingConstants.LEFT );
        sorc.addActionListener(this);
        allpanels.add(sorc);
        
        sin = new JButton();
        sin.setText("Assassin(" + Sintree.getsinpoints() + ")");
        sin.setSize(110,20);
        sin.setLocation(435, 450);
        sin.setHorizontalAlignment( SwingConstants.LEFT );
        sin.addActionListener(this);
        allpanels.add(sin);
        
        
        info = new JLabel();
        info.setText("<html>Points Used: " + zerktreepoints + "<br>Points Left: " + (totalpoints-(zerktreepoints)) + "</html>");
        info.setSize(550,40);
        info.setHorizontalAlignment( SwingConstants.CENTER );
        info.setLocation(0, 470);
        allpanels.add(info);
        
        reset = new JButton();
        reset.setText("Reset Tree");
        reset.setSize(100, 20);
        reset.setLocation(225, 510);
        reset.setHorizontalAlignment( SwingConstants.CENTER );
        reset.addActionListener(this);
        allpanels.add(reset);
        
        resetall = new JButton("Reset All");
        resetall.setSize(100, 20);
        resetall.setLocation(225, 530);
        resetall.setHorizontalAlignment( SwingConstants.CENTER );
        resetall.addActionListener(this);
        allpanels.add(resetall);
        
      //row1
        row1 = new JPanel();
        row1.setLayout(null);
        row1.setLocation(0, 0);
        row1.setSize(430, 60);
        row1.setBackground(Color.lightGray);
        row1.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.BLACK));
        skills.add(row1);
        

        //crush
        img = new ImageIcon(getClass().getResource("/zerk/crush.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        crus = new JButton((Icon) img);
        crus.setToolTipText("<html>" + crush.popup() + "</html>");
        crus.setSize(40, 40);
        crus.setLocation(10, 10);
        crus.addActionListener(this);
        row1.add(crus);
        
        cru = new JLabel();
        cru.setText(crush.getlv() + "/" + crush.getmax());
        cru.setSize(20,20);
        cru.setLocation(50, 30);
        row1.add(cru);
        
      //Neutralize
        img = new ImageIcon(getClass().getResource("/zerk/neutralize.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        neutraliz = new JButton((Icon) img);
        neutraliz.setToolTipText("<html>" + neutralize.popup() + "</html>");
        neutraliz.setSize(40, 40);
        neutraliz.setLocation(80, 10);
        neutraliz.addActionListener(this);
        row1.add(neutraliz);
        
        neutrali = new JLabel();
        neutrali.setText(neutralize.getlv() + "/" + neutralize.getmax());
        neutrali.setSize(20,20);
        neutrali.setLocation(120, 30);
        row1.add(neutrali);
        
        img = new ImageIcon(getClass().getResource("/zerk/rightarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(30, 20,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        row1arr = new JLabel((Icon) img);
        row1arr.setSize(30,20);
        row1arr.setLocation(120, 10);
        row1.add(row1arr);
        
      //Dodge Attack
        img = new ImageIcon(getClass().getResource("/zerk/dodge.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        dodg = new JButton((Icon) img);
        dodg.setToolTipText("<html>" + dodge.popup() + "</html>");
        dodg.setSize(40, 40);
        dodg.setLocation(150, 10);
        dodg.addActionListener(this);
        row1.add(dodg);
        
        dod = new JLabel();
        dod.setText(dodge.getlv() + "/" + dodge.getmax());
        dod.setSize(20,20);
        dod.setLocation(190, 30);
        row1.add(dod);
        
      //No mercy
        img = new ImageIcon(getClass().getResource("/zerk/nomercy.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        nomerc = new JButton((Icon) img);
        nomerc.setToolTipText("<html>" + nomercy.popup() + "</html>");
        nomerc.setSize(40, 40);
        nomerc.setLocation(290, 10);
        nomerc.addActionListener(this);
        row1.add(nomerc);
        
        nomer = new JLabel();
        nomer.setText(nomercy.getlv() + "/" + nomercy.getmax());
        nomer.setSize(20,20);
        nomer.setLocation(330, 30);
        row1.add(nomer);
        
      //2h mastery
        img = new ImageIcon(getClass().getResource("/zerk/2hmastery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        twohmaster = new JButton((Icon) img);
        twohmaster.setToolTipText("<html>" + twohmastery.popup() + "</html>");
        twohmaster.setSize(40, 40);
        twohmaster.setLocation(360, 10);
        twohmaster.addActionListener(this);
        row1.add(twohmaster);
        
        twohmaste = new JLabel();
        twohmaste.setText(twohmastery.getlv() + "/" + twohmastery.getmax());
        twohmaste.setSize(20,20);
        twohmaste.setLocation(400, 30);
        row1.add(twohmaste);
        
      //row2
        row2 = new JPanel();
        row2.setLayout(null);
        row2.setLocation(0, 60);
        row2.setSize(430, 60);
        row2.setBackground(Color.lightGray);
        row2.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row2);
        
      //Nocturne
        img = new ImageIcon(getClass().getResource("/zerk/nocturne.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        nocturn = new JButton((Icon) img);
        nocturn.setToolTipText("<html>" + nocturne.popup() + "</html>");
        nocturn.setSize(40, 40);
        nocturn.setLocation(80, 10);
        nocturn.addActionListener(this);
        row2.add(nocturn);
        
        noctur = new JLabel();
        noctur.setText(nocturne.getlv() + "/" + nocturne.getmax());
        noctur.setSize(20,20);
        noctur.setLocation(120, 30);
        row2.add(noctur);
        
      //Berserk
        img = new ImageIcon(getClass().getResource("/zerk/berserk.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        berser = new JButton((Icon) img);
        berser.setToolTipText("<html>" + berserk.popup() + "</html>");
        berser.setSize(40, 40);
        berser.setLocation(290, 10);
        berser.addActionListener(this);
        row2.add(berser);
        
        berse = new JLabel();
        berse.setText(berserk.getlv() + "/" + berserk.getmax());
        berse.setSize(20,20);
        berse.setLocation(330, 30);
        row2.add(berse);
        
      //row3
        row3 = new JPanel();
        row3.setLayout(null);
        row3.setLocation(0, 120);
        row3.setSize(430, 60);
        row3.setBackground(Color.lightGray);
        row3.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row3);
        
      //Buffalo Charge
        img = new ImageIcon(getClass().getResource("/zerk/buffalo.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        buffal = new JButton((Icon) img);
        buffal.setToolTipText("<html>" + buffalo.popup() + "</html>");
        buffal.setSize(40, 40);
        buffal.setLocation(80, 10);
        buffal.addActionListener(this);
        row3.add(buffal);
        
        buffa= new JLabel();
        buffa.setText(buffalo.getlv() + "/" + buffalo.getmax());
        buffa.setSize(20,20);
        buffa.setLocation(120, 30);
        row3.add(buffa);
        
      //Furious Dash
        img = new ImageIcon(getClass().getResource("/zerk/furious.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        furiou = new JButton((Icon) img);
        furiou.setToolTipText("<html>" + furious.popup() + "</html>");
        furiou.setSize(40, 40);
        furiou.setLocation(220, 10);
        furiou.addActionListener(this);
        row3.add(furiou);
        
        furio= new JLabel();
        furio.setText(furious.getlv() + "/" + furious.getmax());
        furio.setSize(20,20);
        furio.setLocation(260, 30);
        row3.add(furio);
        
      //Blood Feast
        img = new ImageIcon(getClass().getResource("/zerk/feast.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        feas = new JButton((Icon) img);
        feas.setToolTipText("<html>" + feast.popup() + "</html>");
        feas.setSize(40, 40);
        feas.setLocation(360, 10);
        feas.addActionListener(this);
        row3.add(feas);
        
        fea= new JLabel();
        fea.setText(feast.getlv() + "/" + feast.getmax());
        fea.setSize(20,20);
        fea.setLocation(400, 30);
        row3.add(fea);
        
        img = new ImageIcon(getClass().getResource("/zerk/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        row3arr = new JLabel((Icon) img);
        row3arr.setSize(20,58);
        row3arr.setLocation(300, 1);
        row3.add(row3arr);
        
        img = new ImageIcon(getClass().getResource("/zerk/fixeddown.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 35,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr1 = new JLabel((Icon) img);
        arr1.setSize(20,35);
        arr1.setLocation(230, 95);
        skills.add(arr1,0);
        
        img = new ImageIcon(getClass().getResource("/zerk/redline.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(50, 7,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        line1 = new JLabel((Icon) img);
        line1.setSize(50,7);
        line1.setLocation(237, 88);
        skills.add(line1,0);
        
        img = new ImageIcon(getClass().getResource("/zerk/longarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 126,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr2 = new JLabel((Icon) img);
        arr2.setSize(20,126);
        arr2.setLocation(20, 57);
        skills.add(arr2,0);
        
        img = new ImageIcon(getClass().getResource("/zerk/longarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 126,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr3 = new JLabel((Icon) img);
        arr3.setSize(20,126);
        arr3.setLocation(160, 57);
        skills.add(arr3,0);
        
        img = new ImageIcon(getClass().getResource("/zerk/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 20,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr4 = new JLabel((Icon) img);
        arr4.setSize(20,20);
        arr4.setLocation(230, 170);
        skills.add(arr4,0);
        
      //row4
        row4 = new JPanel();
        row4.setLayout(null);
        row4.setLocation(0, 180);
        row4.setSize(430, 60);
        row4.setBackground(Color.lightGray);
        row4.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row4);
        
      //vanquish
        img = new ImageIcon(getClass().getResource("/zerk/vanquish.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        vanquis = new JButton((Icon) img);
        vanquis.setToolTipText("<html>" + vanquish.popup() + "</html>");
        vanquis.setSize(40, 40);
        vanquis.setLocation(10, 10);
        vanquis.addActionListener(this);
        row4.add(vanquis);
        
        vanqui = new JLabel();
        vanqui.setText(vanquish.getlv() + "/" + vanquish.getmax());
        vanqui.setSize(20,20);
        vanqui.setLocation(50, 30);
        row4.add(vanqui);
        
      //Armageddon
        img = new ImageIcon(getClass().getResource("/zerk/armageddon.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        armageddo = new JButton((Icon) img);
        armageddo.setToolTipText("<html>" + armageddon.popup() + "</html>");
        armageddo.setSize(40, 40);
        armageddo.setLocation(150, 10);
        armageddo.addActionListener(this);
        row4.add(armageddo);
        
        armagedd = new JLabel();
        armagedd.setText(armageddon.getlv() + "/" + armageddon.getmax());
        armagedd.setSize(20,20);
        armagedd.setLocation(190, 30);
        row4.add(armagedd);
        
      //Inertia
        img = new ImageIcon(getClass().getResource("/zerk/inertia.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        inerti = new JButton((Icon) img);
        inerti.setToolTipText("<html>" + inertia.popup() + "</html>");
        inerti.setSize(40, 40);
        inerti.setLocation(220, 10);
        inerti.addActionListener(this);
        row4.add(inerti);
        
        inert = new JLabel();
        inert.setText(inertia.getlv() + "/" + inertia.getmax());
        inert.setSize(20,20);
        inert.setLocation(260, 30);
        row4.add(inert);
        
      //Tranquility
        img = new ImageIcon(getClass().getResource("/zerk/tranquility.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        tranquilit = new JButton((Icon) img);
        tranquilit.setToolTipText("<html>" + tranquility.popup() + "</html>");
        tranquilit.setSize(40, 40);
        tranquilit.setLocation(290, 10);
        tranquilit.addActionListener(this);
        row4.add(tranquilit);
        
        tranquili = new JLabel();
        tranquili.setText(tranquility.getlv() + "/" + tranquility.getmax());
        tranquili.setSize(20,20);
        tranquili.setLocation(330, 30);
        row4.add(tranquili);
        
      //Cruelty
        img = new ImageIcon(getClass().getResource("/zerk/cruelty.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        cruelt = new JButton((Icon) img);
        cruelt.setToolTipText("<html>" + cruelty.popup() + "</html>");
        cruelt.setSize(40, 40);
        cruelt.setLocation(360, 10);
        cruelt.addActionListener(this);
        row4.add(cruelt);
        
        cruel = new JLabel();
        cruel.setText(cruelty.getlv() + "/" + cruelty.getmax());
        cruel.setSize(20,20);
        cruel.setLocation(400, 30);
        row4.add(cruel);
        
        img = new ImageIcon(getClass().getResource("/zerk/longarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 126,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr5 = new JLabel((Icon) img);
        arr5.setSize(20,126);
        arr5.setLocation(300, 237);
        skills.add(arr5,0);
        
        img = new ImageIcon(getClass().getResource("/zerk/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 20,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr6 = new JLabel((Icon) img);
        arr6.setSize(20,20);
        arr6.setLocation(230, 230);
        skills.add(arr6,0);
        
      //row5
        row5 = new JPanel();
        row5.setLayout(null);
        row5.setLocation(0, 240);
        row5.setSize(430, 60);
        row5.setBackground(Color.lightGray);
        row5.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row5);
        
        img = new ImageIcon(getClass().getResource("/zerk/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr7 = new JLabel((Icon) img);
        arr7.setSize(20,58);
        arr7.setLocation(20, 1);
        row5.add(arr7);
        
      //Bash
        img = new ImageIcon(getClass().getResource("/zerk/bash.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        bas = new JButton((Icon) img);
        bas.setToolTipText("<html>" + bash.popup() + "</html>");
        bas.setSize(40, 40);
        bas.setLocation(80, 10);
        bas.addActionListener(this);
        row5.add(bas);
        
        ba = new JLabel();
        ba.setText(bash.getlv() + "/" + bash.getmax());
        ba.setSize(20,20);
        ba.setLocation(120, 30);
        row5.add(ba);
        
      //Scamper
        img = new ImageIcon(getClass().getResource("/zerk/scamper.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        scampe = new JButton((Icon) img);
        scampe.setToolTipText("<html>" + scamper.popup() + "</html>");
        scampe.setSize(40, 40);
        scampe.setLocation(220, 10);
        scampe.addActionListener(this);
        row5.add(scampe);
        
        scamp = new JLabel();
        scamp.setText(scamper.getlv() + "/" + scamper.getmax());
        scamp.setSize(20,20);
        scamp.setLocation(260, 30);
        row5.add(scamp);
        
      //Grevious Wounds
        img = new ImageIcon(getClass().getResource("/zerk/wounds.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        wound = new JButton((Icon) img);
        wound.setToolTipText("<html>" + wounds.popup() + "</html>");
        wound.setSize(40, 40);
        wound.setLocation(360, 10);
        wound.addActionListener(this);
        row5.add(wound);
        
        woun = new JLabel();
        woun.setText(wounds.getlv() + "/" + wounds.getmax());
        woun.setSize(20,20);
        woun.setLocation(400, 30);
        row5.add(woun);
        
      //row6
        row6 = new JPanel();
        row6.setLayout(null);
        row6.setLocation(0, 300);
        row6.setSize(430, 60);
        row6.setBackground(Color.lightGray);
        row6.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row6);
        
      //Upward Strike
        img = new ImageIcon(getClass().getResource("/zerk/upward.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        upwar = new JButton((Icon) img);
        upwar.setToolTipText("<html>" + upward.popup() + "</html>");
        upwar.setSize(40, 40);
        upwar.setLocation(10, 10);
        upwar.addActionListener(this);
        row6.add(upwar);
        
        upwa = new JLabel();
        upwa.setText(upward.getlv() + "/" + upward.getmax());
        upwa.setSize(20,20);
        upwa.setLocation(50, 30);
        row6.add(upwa);
        
      //Escape
        img = new ImageIcon(getClass().getResource("/zerk/escape.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        escap = new JButton((Icon) img);
        escap.setToolTipText("<html>" + escape.popup() + "</html>");
        escap.setSize(40, 40);
        escap.setLocation(150, 10);
        escap.addActionListener(this);
        row6.add(escap);
        
        esca = new JLabel();
        esca.setText(escape.getlv() + "/" + escape.getmax());
        esca.setSize(20,20);
        esca.setLocation(190, 30);
        row6.add(esca);
        
      //row7
        row7 = new JPanel();
        row7.setLayout(null);
        row7.setLocation(0, 360);
        row7.setSize(430, 60);
        row7.setBackground(Color.lightGray);
        row7.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row7);
        
      //Tornado
        img = new ImageIcon(getClass().getResource("/zerk/tornado.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        tornad = new JButton((Icon) img);
        tornad.setToolTipText("<html>" + tornado.popup() + "</html>");
        tornad.setSize(40, 40);
        tornad.setLocation(150, 10);
        tornad.addActionListener(this);
        row7.add(tornad);
        
        torna = new JLabel();
        torna.setText(tornado.getlv() + "/" + tornado.getmax());
        torna.setSize(20,20);
        torna.setLocation(190, 30);
        row7.add(torna);
        
      //Controlled Madness
        img = new ImageIcon(getClass().getResource("/zerk/madness.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        madnes = new JButton((Icon) img);
        madnes.setToolTipText("<html>" + madness.popup() + "</html>");
        madnes.setSize(40, 40);
        madnes.setLocation(290, 10);
        madnes.addActionListener(this);
        row7.add(madnes);
        
        madne = new JLabel();
        madne.setText(madness.getlv() + "/" + madness.getmax());
        madne.setSize(20,20);
        madne.setLocation(330, 30);
        row7.add(madne);
        
      //Blood of Berserker
        img = new ImageIcon(getClass().getResource("/zerk/zerkblood.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        zerkbloo = new JButton((Icon) img);
        zerkbloo.setToolTipText("<html>" + zerkblood.popup() + "</html>");
        zerkbloo.setSize(40, 40);
        zerkbloo.setLocation(360, 10);
        zerkbloo.addActionListener(this);
        row7.add(zerkbloo);
        
        zerkblo = new JLabel();
        zerkblo.setText(zerkblood.getlv() + "/" + zerkblood.getmax());
        zerkblo.setSize(20,20);
        zerkblo.setLocation(400, 30);
        row7.add(zerkblo);
        
        
        
        
        
        
        
        allpanels.setOpaque(true);
        return allpanels;
        
        
        
	}
	
	public void updatezerk() {
		int allpoints = (Deftree.getdefpoints()+Sintree.getsinpoints()+zerktreepoints+Sorctree.getsorcpoints()+Clertree.getclerpoints());
		info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
		sin.setText("Assassin(" + Sintree.getsinpoints() + ")");
		def.setText("Defender(" + Deftree.getdefpoints() + ")");
		sorc.setText("Sorcerer(" + Sorctree.getsorcpoints() + ")");
		cleric.setText("Cleric(" + Clertree.getclerpoints() + ")");
	
	}

	public void recentset() {
		recentreset = true;
	}
	
	
	public void actionPerformed(ActionEvent e) {
		int allpoints = (zerktreepoints+Sintree.getsinpoints()+Deftree.getdefpoints()+Sorctree.getsorcpoints()+Clertree.getclerpoints());
		
		if(e.getSource() == reset) {
			zerktreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
	        Alltrees.resetzerk();
			
        }
		if(e.getSource() == sin) {
			//deftreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
			recentreset = false;
	        Alltrees.switchsin();
        } else if(e.getSource() == resetall) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
	        Alltrees.resetall(); 
			
        }else if(e.getSource() == def) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchdef(); 
			
        } else if(e.getSource() == sorc) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchsorc(); 
			
        }else if(e.getSource() == cleric) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchcler(); 
			
        } // row1
        else if ((Sintree.getsinpoints() == 0 && Deftree.getdefpoints() == 0 && Sorctree.getsorcpoints() == 0 && Clertree.getclerpoints() == 0) || Sintree.getsinpoints() >= 10 || Deftree.getdefpoints() >= 10 ||
		zerktreepoints >= 10 || Sorctree.getsorcpoints() >= 10 || recentreset || Clertree.getclerpoints() >= 10) {
        	//row1
        	if(e.getSource() == crus) {
				if (crush.getlv() < crush.getmax() && crush.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					crush.setcurlv(crush.getlv()+1);
					crus.setToolTipText("<html>" + crush.popup() + "</html>");
					cru.setText(crush.getlv() + "/" + crush.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == neutraliz) {
				if (neutralize.getlv() < neutralize.getmax() && neutralize.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					neutralize.setcurlv(neutralize.getlv()+1);
					neutraliz.setToolTipText("<html>" + neutralize.popup() + "</html>");
					neutrali.setText(neutralize.getlv() + "/" + neutralize.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == dodg) {
				if (dodge.getlv() < dodge.getmax() && dodge.getpoints() <= zerktreepoints && totalpoints > allpoints && neutralize.getlv() > 0) {
					zerktreepoints ++;
					allpoints ++;
					dodge.setcurlv(dodge.getlv()+1);
					dodg.setToolTipText("<html>" + dodge.popup() + "</html>");
					dod.setText(dodge.getlv() + "/" + dodge.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == nomerc) {
				if (nomercy.getlv() < nomercy.getmax() && nomercy.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					nomercy.setcurlv(nomercy.getlv()+1);
					nomerc.setToolTipText("<html>" + nomercy.popup() + "</html>");
					nomer.setText(nomercy.getlv() + "/" + nomercy.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == twohmaster) {
				if (twohmastery.getlv() < twohmastery.getmax() && twohmastery.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					twohmastery.setcurlv(twohmastery.getlv()+1);
					twohmaster.setToolTipText("<html>" + twohmastery.popup() + "</html>");
					twohmaste.setText(twohmastery.getlv() + "/" + twohmastery.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row2
			else if(e.getSource() == nocturn) {
				if (nocturne.getlv() < nocturne.getmax() && nocturne.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					nocturne.setcurlv(nocturne.getlv()+1);
					nocturn.setToolTipText("<html>" + nocturne.popup() + "</html>");
					noctur.setText(nocturne.getlv() + "/" + nocturne.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == berser) {
				if (berserk.getlv() < berserk.getmax() && berserk.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					berserk.setcurlv(berserk.getlv()+1);
					berser.setToolTipText("<html>" + berserk.popup() + "</html>");
					berse.setText(berserk.getlv() + "/" + berserk.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row3
			else if(e.getSource() == buffal) {
				if (buffalo.getlv() < buffalo.getmax() && buffalo.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					buffalo.setcurlv(buffalo.getlv()+1);
					buffal.setToolTipText("<html>" + buffalo.popup() + "</html>");
					buffa.setText(buffalo.getlv() + "/" + buffalo.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == furiou) {
				if (furious.getlv() < furious.getmax() && furious.getpoints() <= zerktreepoints && totalpoints > allpoints && berserk.getlv() > 0) {
					zerktreepoints ++;
					allpoints ++;
					furious.setcurlv(furious.getlv()+1);
					furiou.setToolTipText("<html>" + furious.popup() + "</html>");
					furio.setText(furious.getlv() + "/" + furious.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == feas) {
				if (feast.getlv() < feast.getmax() && feast.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					feast.setcurlv(feast.getlv()+1);
					feas.setToolTipText("<html>" + feast.popup() + "</html>");
					fea.setText(feast.getlv() + "/" + feast.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row4
			else if(e.getSource() == vanquis) {
				if (vanquish.getlv() < vanquish.getmax() && vanquish.getpoints() <= zerktreepoints && totalpoints > allpoints && crush.getlv() > 0) {
					zerktreepoints ++;
					allpoints ++;
					vanquish.setcurlv(vanquish.getlv()+1);
					vanquis.setToolTipText("<html>" + vanquish.popup() + "</html>");
					vanqui.setText(vanquish.getlv() + "/" + vanquish.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == armageddo) {
				if (armageddon.getlv() < armageddon.getmax() && armageddon.getpoints() <= zerktreepoints && totalpoints > allpoints && dodge.getlv() > 0) {
					zerktreepoints ++;
					allpoints ++;
					armageddon.setcurlv(armageddon.getlv()+1);
					armageddo.setToolTipText("<html>" + armageddon.popup() + "</html>");
					armagedd.setText(armageddon.getlv() + "/" + armageddon.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == inerti) {
				if (inertia.getlv() < inertia.getmax() && inertia.getpoints() <= zerktreepoints && totalpoints > allpoints && furious.getlv() > 0) {
					zerktreepoints ++;
					allpoints ++;
					inertia.setcurlv(inertia.getlv()+1);
					inerti.setToolTipText("<html>" + inertia.popup() + "</html>");
					inert.setText(inertia.getlv() + "/" + inertia.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == tranquilit) {
				if (tranquility.getlv() < tranquility.getmax() && tranquility.getpoints() <= zerktreepoints && totalpoints > allpoints && berserk.getlv() > 0) {
					zerktreepoints ++;
					allpoints ++;
					tranquility.setcurlv(tranquility.getlv()+1);
					tranquilit.setToolTipText("<html>" + tranquility.popup() + "</html>");
					tranquili.setText(tranquility.getlv() + "/" + tranquility.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == cruelt) {
				if (cruelty.getlv() < cruelty.getmax() && cruelty.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					cruelty.setcurlv(cruelty.getlv()+1);
					cruelt.setToolTipText("<html>" + cruelty.popup() + "</html>");
					cruel.setText(cruelty.getlv() + "/" + cruelty.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row5
			else if(e.getSource() == bas) {
				if (bash.getlv() < bash.getmax() && bash.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					bash.setcurlv(bash.getlv()+1);
					bas.setToolTipText("<html>" + bash.popup() + "</html>");
					ba.setText(bash.getlv() + "/" + bash.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == scampe) {
				if (scamper.getlv() < scamper.getmax() && scamper.getpoints() <= zerktreepoints && totalpoints > allpoints && inertia.getlv() > 0) {
					zerktreepoints ++;
					allpoints ++;
					scamper.setcurlv(scamper.getlv()+1);
					scampe.setToolTipText("<html>" + scamper.popup() + "</html>");
					scamp.setText(scamper.getlv() + "/" + scamper.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == wound) {
				if (wounds.getlv() < wounds.getmax() && wounds.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					wounds.setcurlv(wounds.getlv()+1);
					wound.setToolTipText("<html>" + wounds.popup() + "</html>");
					woun.setText(wounds.getlv() + "/" + wounds.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row6
			else if(e.getSource() == upwar) {
				if (upward.getlv() < upward.getmax() && upward.getpoints() <= zerktreepoints && totalpoints > allpoints && vanquish.getlv() > 0) {
					zerktreepoints ++;
					allpoints ++;
					upward.setcurlv(upward.getlv()+1);
					upwar.setToolTipText("<html>" + upward.popup() + "</html>");
					upwa.setText(upward.getlv() + "/" + upward.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == escap) {
				if (escape.getlv() < escape.getmax() && escape.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					escape.setcurlv(escape.getlv()+1);
					escap.setToolTipText("<html>" + escape.popup() + "</html>");
					esca.setText(escape.getlv() + "/" + escape.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row7
			else if(e.getSource() == tornad) {
				if (tornado.getlv() < tornado.getmax() && tornado.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					tornado.setcurlv(tornado.getlv()+1);
					tornad.setToolTipText("<html>" + tornado.popup() + "</html>");
					torna.setText(tornado.getlv() + "/" + tornado.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == madnes) {
				if (madness.getlv() < madness.getmax() && madness.getpoints() <= zerktreepoints && totalpoints > allpoints && tranquility.getlv() > 0) {
					zerktreepoints ++;
					allpoints ++;
					madness.setcurlv(madness.getlv()+1);
					madnes.setToolTipText("<html>" + madness.popup() + "</html>");
					madne.setText(madness.getlv() + "/" + madness.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == zerkbloo) {
				if (zerkblood.getlv() < zerkblood.getmax() && zerkblood.getpoints() <= zerktreepoints && totalpoints > allpoints) {
					zerktreepoints ++;
					allpoints ++;
					zerkblood.setcurlv(zerkblood.getlv()+1);
					zerkbloo.setToolTipText("<html>" + zerkblood.popup() + "</html>");
					zerkblo.setText(zerkblood.getlv() + "/" + zerkblood.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			}	
        	
        }
		if (zerktreepoints == 5) {
			ImageIcon img = new ImageIcon(getClass().getResource("/zerk/outrage.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        outrage.setIcon((Icon) img);
	        img = new ImageIcon(getClass().getResource("/zerk/chainmastery.png"));
	        test = img.getImage();
	        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
			chain.setIcon((Icon) img);
		}
		if (zerktreepoints == 10) {
			ImageIcon img = new ImageIcon(getClass().getResource("/zerk/stylemastery.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        cross.setIcon((Icon) img);
	        recentreset = false;
		}
		if (zerktreepoints == 15) {
			ImageIcon img = new ImageIcon(getClass().getResource("/zerk/platemastery.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        plate.setIcon((Icon) img);
	        img = new ImageIcon(getClass().getResource("/zerk/thirst.png"));
	        test = img.getImage();
	        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
			thir1.setIcon((Icon) img);
		}
		if (zerktreepoints == 20) {
	        ImageIcon img = new ImageIcon(getClass().getResource("/zerk/sustained.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
			rage1.setIcon((Icon) img);
		}
		if (zerktreepoints == 25) {
	        ImageIcon img = new ImageIcon(getClass().getResource("/zerk/thirst.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
			thir2.setIcon((Icon) img);
		}
		if (zerktreepoints == 30) {
	        ImageIcon img = new ImageIcon(getClass().getResource("/zerk/sustained.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
			rage2.setIcon((Icon) img);
		}
		if (zerktreepoints == 35) {
			ImageIcon img = new ImageIcon(getClass().getResource("/zerk/thirst.png"));
			Image test = img.getImage();
			Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
			thir3.setIcon((Icon) img);
		}
		zerk.setText("Berserker(" + zerktreepoints + ")");
		allpoints = (zerktreepoints+Sintree.getsinpoints()+Deftree.getdefpoints()+Sorctree.getsorcpoints()+Clertree.getclerpoints());
		if (allpoints == 40) {
			if (zerktreepoints < 10 && Clertree.getclerpoints() < 10 && Sorctree.getsorcpoints() < 10 && Deftree.getdefpoints() < 10 && 
					Sintree.getsinpoints() < 10) {
				JOptionPane.showMessageDialog (null, "Error: Invalid Tree\nNone of the class trees has at least 10 points\n" +
						"Reseting",
		        			"Invalid", JOptionPane.ERROR_MESSAGE);
				Alltrees.resetall();
			}
		}
		
	}
	
	
	private static void createAndShowGUI() {

        JFrame.setDefaultLookAndFeelDecorated(true);
        frame = new JFrame("Zerk Skill Tree  by Avenaei(Andrew)");

        //Create and set up the content pane.
        Zerktree demo = new Zerktree();
        frame.setContentPane(demo.createContentPane());

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(560, 600);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setLocation((dim.width/2)-(frame.getSize().width/2), dim.height/2-frame.getSize().height/2);
        frame.setVisible(true);
    }
	public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }

}
